package com.homwee.tvap.common.comSettingInterface;

//zcj 2018-10-30 import com.changhong.android.tvapi.common.vo.ChOsType;
//zcj 2018-10-30 import com.changhong.android.tvapi.common.vo.ChOsType.CHEnumColorSystem;
//zcj 2018-10-30 import com.changhong.android.tvapi.common.vo.ChOsType.CHEnumSoundSystem;
//zcj 2018-10-30 import com.changhong.android.tvapi.common.vo.EnumAvdVideoStandardType;
//zcj 2018-10-30 import com.changhong.tvos.service.TvChannelManager;
//zcj 2018-10-30 import com.changhong.tvos.service.TvFactoryManager;
//zcj 2018-10-30 import com.changhong.tvos.service.TvMiscManager;
import java.util.List;

import com.mediatek.twoworlds.factory.MtkTvFApiDisplayTest;
import com.mediatek.twoworlds.factory.MtkTvFApiInformation;
import com.mediatek.twoworlds.factory.MtkTvFApiInputSource;
import com.mediatek.twoworlds.factory.common.MtkTvFApiInputSourceTypes;
import com.mediatek.twoworlds.factory.common.inimanager.MtkTvFApiInputSourceIniManager;
import com.mediatek.twoworlds.tv.MtkTvBroadcast;
import com.mediatek.twoworlds.tv.MtkTvBroadcastBase;
import com.mediatek.twoworlds.tv.MtkTvChannelList;
import com.mediatek.twoworlds.tv.MtkTvConfig;
import com.mediatek.twoworlds.tv.common.MtkTvChCommonBase;
import com.mediatek.twoworlds.tv.common.MtkTvConfigType;
import com.mediatek.twoworlds.tv.model.MtkTvChannelInfoBase;
import com.mediatek.twoworlds.tv.model.TvProviderChannelInfoBase;
import com.mediatek.twoworlds.tv.MtkTvRecord;

import android.content.Context;

import android.text.TextUtils;
import android.util.Log;
//import com.changhong.tvos.atv.ATVChannelManager;
//import com.changhong.tvos.atv.IATVPlayer;
//import com.changhong.tvos.common.MiscManager;
//import com.changhong.tvos.common.TVManager;
//import com.changhong.tvos.common.exception.ChannelNotFoundException;
//import com.changhong.tvos.model.ATVChannelInfo;
//import com.changhong.tvos.model.ChOsType;
//import com.changhong.tvos.model.ChOsType.CHEnumColorSystem;
//import com.changhong.tvos.model.ChOsType.CHEnumSoundSystem;
//import com.changhong.tvos.model.EnumInputSource;

//page 3
public class factoryPage3 {
	// zcj 2018-10-30 private TvChannelManager mTvChannelManager = null;
	// zcj 2018-10-30 private TvMiscManager mTvMiscManager = null;
	// private TvFactoryManager mTvFactoryManager = null;
	MtkTvFApiDisplayTest mMtkTvFApiDisplayTest = null;
	MtkTvFApiInputSource mMtkTvFApiInputSource = null;
	MtkTvFApiInputSourceTypes.EnumTunerAtvVdType tunerAtvVdParams = null;
	MtkTvFApiInformation mMtkTvFApiInformation = null;
	MtkTvConfig mMtkTvConfig = null;
	MtkTvBroadcast mtkTvBroadcast =null;
	MtkTvChannelList mtkTvChannelList =null;
	MtkTvRecord mTvRecord = null;
	// TVManager tvManager;
	// IATVPlayer mIatvPlayer =null;
	// MiscManager mMiscManager =null;
	// private static ATVChannelManager atvChannelManager;
	static factoryPage3 Interface = null;
	MenuConfigManager mCfg = MenuConfigManager.getInstance(null);

	// ATVChannelInfo channelInfo;
	private factoryPage3(Context context) {
		// tvManager = TVManager.getInstance(context);
		try {
			// zcj 2018-10-30 mTvChannelManager =
			// TvChannelManager.getInstance();
			// zcj 2018-10-30 mTvMiscManager = TvMiscManager.getInstance();
			// mTvFactoryManager = TvFactoryManager.getInstance();
			mMtkTvFApiDisplayTest = MtkTvFApiDisplayTest.getInstance();
			mMtkTvFApiInputSource = MtkTvFApiInputSource.getInstance();
			// tunerAtvVdParams = new MtkTvFApiInputSourceTypes;
			mMtkTvFApiInformation = MtkTvFApiInformation.getInstance();
			mMtkTvConfig = MtkTvConfig.getInstance();
			mtkTvBroadcast = MtkTvBroadcast.getInstance();
			mtkTvChannelList = MtkTvChannelList.getInstance();

			mTvRecord = MtkTvRecord.getInstance();

		} catch (Exception e) {
			// TODO: handle exception
			Log.v("tv", "mTvChannelManager ==null");
		}
	}

	public static factoryPage3 getInstance(Context context) {
		if (Interface == null) {
			Interface = new factoryPage3(context);
		}
		return Interface;
	}

	public int getMuteColerIndex() {
		// mTvFactoryManager.VIDEO_MUTE_COLOR_BLACK;
		// return mTvFactoryManager.getVideoMuteColor();
		// return mMtkTvFApiDisplayTest.getVideoTestPattern();
		return 4;
	}

	public boolean setMuteColerIndex(int index) {

		// return mTvFactoryManager.setVideoMuteColor(index);
		// zcj 2018-10-30 return
		mMtkTvFApiDisplayTest.setVideoTestPattern(index);
		return false;
	}

	public int getColorMode() throws Exception {
		// mMtkTvFApiInformation.getTvInformation();

		return 0;

	}

	/*
	 * //zcj 2018-10-30 public ChOsType.CHEnumSoundSystem getAudioMode() throws
	 * Exception{ ChOsType.CHEnumSoundSystem type
	 * =ChOsType.CHEnumSoundSystem.SOUND_SYSTEM_AUTO; int mstType = 0;
	 * if(mTvChannelManager !=null){ // type
	 * =mTvChannelManager.getChannelInfo(mTvChannelManager
	 * .getCurChannelNum()).meSoundSystem; mstType =
	 * mTvChannelManager.getAtvCurrentSoundSystem(); switch(mstType) { case 0:
	 * type = ChOsType.CHEnumSoundSystem.values()[1]; break; case 1: type =
	 * ChOsType.CHEnumSoundSystem.values()[2]; break; case 2: type
	 * =ChOsType.CHEnumSoundSystem.values()[0];
	 * //ChOsType.CHEnumSoundSystem.SOUND_SYSTEM_DK; break; case 3: type =
	 * ChOsType.CHEnumSoundSystem.values()[0]; //? break; case 4: type =
	 * ChOsType.CHEnumSoundSystem.values()[3]; break;
	 * 
	 * default: type = ChOsType.CHEnumSoundSystem.values()[0]; break;
	 * 
	 * }
	 * 
	 * }
	 * 
	 * return type; }
	 */

	public void setColorMode(int colorMode) throws Exception {
		int mstType = 0;
		// zcj 2018-10-30 if(mTvChannelManager !=null){
		/*
		 * ATVChannelInfo channelInfo; channelInfo =
		 * atvChannelManager.getChannelInfo
		 * (atvChannelManager.getCurChannelNum()); channelInfo.meColorSystem
		 * =CHEnumColorSystem.values().clone()[colorMode];
		 * atvChannelManager.setChannelInfo
		 * (atvChannelManager.getCurChannelNum(),channelInfo);
		 * atvChannelManager.updateChannelinfo();
		 */
		// mTvChannelManager.setChannelColorSystem(mTvChannelManager.getCurChannelNum()
		// ,CHEnumColorSystem.values().clone()[colorMode]);
		/*
		 * //zcj 2018-10-30 if(colorMode ==
		 * ChOsType.CHEnumColorSystem.COLOR_SYSTEM_AUTO.ordinal()){ mstType =
		 * EnumAvdVideoStandardType.AUTO.ordinal(); }else if(colorMode
		 * ==ChOsType.CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal()){ mstType =
		 * EnumAvdVideoStandardType.PAL_BGHI.ordinal(); }else if(colorMode
		 * ==ChOsType.CHEnumColorSystem.COLOR_SYSTEM_NTSC.ordinal()){ mstType =
		 * EnumAvdVideoStandardType.NTSC_M.ordinal(); }else if(colorMode
		 * ==ChOsType.CHEnumColorSystem.COLOR_SYSTEM_SECAM.ordinal()){ mstType
		 * =EnumAvdVideoStandardType.SECAM.ordinal(); }else{ mstType=
		 * EnumAvdVideoStandardType.NOTSTANDARD.ordinal(); }
		 * mTvChannelManager.setAtvVideoStandard(mstType); }
		 */

	}

	public void setAudioMode(int audioMode) throws Exception {
		int mstType = 0;
		// zcj 2018-10-30 if(mTvChannelManager !=null){
		/*
		 * ATVChannelInfo channelInfo; channelInfo =
		 * atvChannelManager.getChannelInfo
		 * (atvChannelManager.getCurChannelNum()); channelInfo.meSoundSystem
		 * =CHEnumSoundSystem.values().clone()[audioMode];
		 * atvChannelManager.setChannelInfo
		 * (atvChannelManager.getCurChannelNum(),channelInfo);
		 * atvChannelManager.updateChannelinfo();
		 */
		// mTvChannelManager.setChannelSounSystem(mTvChannelManager.getCurChannelNum()
		// ,CHEnumSoundSystem.values().clone()[audioMode]);

		/*
		 * //zcj 2018-10-30 switch(audioMode) { case 0://dk mstType = 2; break;
		 * case 1://SOUND_SYSTEM_DK mstType = 0; break; case 2://SOUND_SYSTEM_BG
		 * mstType = 1; break; case 3://SOUND_SYSTEM_I mstType =4;// break;
		 * 
		 * 
		 * default: mstType =0; break;
		 * 
		 * }
		 * 
		 * 
		 * 
		 * 
		 * mTvChannelManager.setAtvAudioStandard(mstType); }
		 */

	}

	public void setATVDTVSearch() {

	}

	public void setATVDTVAllSearchMode() {
		// zcj 2018-10-30
		// mTvChannelManager.setUserScanType(TvChannelManager.TV_SCAN_ALL);

	}

	public void setDTVAllSearchMode() {
		// zcj 2018-10-30
		// mTvChannelManager.setUserScanType(TvChannelManager.TV_SCAN_DTV);
	}

	private static final int STARTCH_NUM = 0;

	/*
	 * private final int[][] mChanghongChannelPresetList = { { STARTCH_NUM + 0,
	 * 49750000, CHEnumColorSystem.COLOR_SYSTEM_NTSC.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()},
	 * 
	 * { STARTCH_NUM + 1, 65750000,
	 * CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()},
	 * 
	 * { STARTCH_NUM + 2, 77250000,
	 * CHEnumColorSystem.COLOR_SYSTEM_NTSC.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_M.ordinal()},
	 * 
	 * { STARTCH_NUM + 3, 85250000,
	 * CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()},
	 * 
	 * { STARTCH_NUM + 4, 103250000,
	 * CHEnumColorSystem.COLOR_SYSTEM_NTSC.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_M.ordinal()},
	 * 
	 * // { STARTCH_NUM + 5, 119250000,
	 * CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(), //
	 * TvAudioSystemOption.TV_BG },
	 * 
	 * { STARTCH_NUM + 5, 128250000,
	 * CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, { STARTCH_NUM + 6,
	 * 160250000, CHEnumColorSystem.COLOR_SYSTEM_NTSC.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_M.ordinal()},
	 * 
	 * { STARTCH_NUM + 7, 168250000,
	 * CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()},
	 * 
	 * { STARTCH_NUM + 8, 184250000,
	 * CHEnumColorSystem.COLOR_SYSTEM_SECAM.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_BG.ordinal()},
	 * 
	 * { STARTCH_NUM + 9, 200250000,
	 * CHEnumColorSystem.COLOR_SYSTEM_NTSC.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_M.ordinal()},
	 * 
	 * { STARTCH_NUM +10, 216250000,
	 * CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()},
	 * 
	 * { STARTCH_NUM +11, 376250000,
	 * CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()},
	 * 
	 * { STARTCH_NUM +12, 451250000,
	 * CHEnumColorSystem.COLOR_SYSTEM_NTSC.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_M.ordinal()},
	 * 
	 * { STARTCH_NUM +13, 463250000,
	 * CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_BG.ordinal()},
	 * 
	 * { STARTCH_NUM +14, 471250000,
	 * CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()},
	 * 
	 * { STARTCH_NUM +15, 519250000,
	 * CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()},
	 * 
	 * { STARTCH_NUM +16, 535250000,
	 * CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal() },
	 * 
	 * { STARTCH_NUM +17, 647250000,
	 * CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_I.ordinal()},
	 * 
	 * { STARTCH_NUM +18, 727250000,
	 * CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_I.ordinal()}, { STARTCH_NUM +19,
	 * 863250000, CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}
	 * 
	 * };
	 */
	/*
	 * private final int[][] mCountryChannelPresetList = { {STARTCH_NUM + 0 ,
	 * 49750000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 1 , 57750000
	 * , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 2 , 65750000
	 * , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 3 , 77250000
	 * , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 4 , 85250000
	 * , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 5 ,
	 * 112250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 6 ,
	 * 120250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 7 ,
	 * 128250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 8 ,
	 * 136250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 9 ,
	 * 144250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 10 ,
	 * 152250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 11 ,
	 * 160250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 12 ,
	 * 168250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 13 ,
	 * 176250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 14 ,
	 * 184250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 15 ,
	 * 192250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 16 ,
	 * 200250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 17 ,
	 * 208250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 18 ,
	 * 216250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 19 ,
	 * 224250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 20 ,
	 * 232250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 21 ,
	 * 240250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 22 ,
	 * 248250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 23 ,
	 * 256250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 24 ,
	 * 264250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 25 ,
	 * 272250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 26 ,
	 * 280250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 27 ,
	 * 288250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 28 ,
	 * 296250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 29 ,
	 * 304250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 30 ,
	 * 312250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 31 ,
	 * 320250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 32 ,
	 * 328250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 33 ,
	 * 336250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 34 ,
	 * 344250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 35 ,
	 * 352250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 36 ,
	 * 360250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 37 ,
	 * 368250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 38 ,
	 * 376250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 39 ,
	 * 384250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 40 ,
	 * 392250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 41 ,
	 * 400250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 42 ,
	 * 408250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 43 ,
	 * 416250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 44 ,
	 * 424250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 45 ,
	 * 432250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 46 ,
	 * 440250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 47 ,
	 * 448250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 48 ,
	 * 456250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 49 ,
	 * 464250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 50 ,
	 * 471250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 51 ,
	 * 479250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 52 ,
	 * 487250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 53 ,
	 * 495250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 54 ,
	 * 503250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 55 ,
	 * 511250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 56 ,
	 * 519250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 57 ,
	 * 527250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 58 ,
	 * 535250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 59 ,
	 * 543250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 60 ,
	 * 551250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 61 ,
	 * 559250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 62 ,
	 * 607250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 63 ,
	 * 615250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 64 ,
	 * 623250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 65 ,
	 * 631250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 66 ,
	 * 639250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 67 ,
	 * 647250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 68 ,
	 * 655250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 69 ,
	 * 663250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 70 ,
	 * 671250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 71 ,
	 * 679250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 72 ,
	 * 687250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 73 ,
	 * 695250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 74 ,
	 * 703250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 75 ,
	 * 711250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 76 ,
	 * 719250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 77 ,
	 * 727250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 78 ,
	 * 735250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 79 ,
	 * 743250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 80 ,
	 * 751250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 81 ,
	 * 759250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 82 ,
	 * 767250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 83 ,
	 * 775250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 84 ,
	 * 783250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 85 ,
	 * 791250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 86 ,
	 * 799250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 87 ,
	 * 807250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 88 ,
	 * 815250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 89 ,
	 * 823250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 90 ,
	 * 831250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 91 ,
	 * 839250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 92 ,
	 * 847250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 93 ,
	 * 855250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}, {STARTCH_NUM + 94 ,
	 * 863250000 , CHEnumColorSystem.COLOR_SYSTEM_PAL.ordinal(),
	 * CHEnumSoundSystem.SOUND_SYSTEM_DK.ordinal()}
	 * 
	 * };
	 */
	public void initATVChannelTable() {
		// zcj 2018-10-30 mTvMiscManager.resetFactoryAtv();
	}

	boolean RFFilterCheck1 = false;
	boolean RFFilterCheck2 = false;
	boolean RFFilterCheck3 = false;
	boolean RFFilterCheck4 = false;

	public String getVHFLow() {
		// TODO Auto-generated method stub

		int low0 = 0;// mTvChannelManager.getRfRilterRatingVHFLow0Margin();
		int low1 = 0;// mTvChannelManager.getRfRilterRatingVHFLow1Margin();
		String mValueStr = low0 + "     " + low1 + "       ";
		if (low0 == 0 || low1 == 0) {
			mValueStr += "NG";
			RFFilterCheck1 = false;
		} else {
			mValueStr += "OK";
			RFFilterCheck1 = true;
		}
		return mValueStr;
	}

	public String getVHFHigh() {
		// TODO Auto-generated method stub
		int high0 = 0;// mTvChannelManager.getRfRilterRatingVHFHigh0Margin();
		int high1 = 0;// mTvChannelManager.getRfRilterRatingVHFHigh1Margin();
		String mValueStr = high0 + "     " + high1 + "       ";
		if (high0 == 0 || high1 == 0) {
			mValueStr += "NG";
			RFFilterCheck2 = false;
		} else {
			mValueStr += "OK";
			RFFilterCheck2 = true;
		}
		return mValueStr;
	}

	public String getUHFLow() {
		// TODO Auto-generated method stub
		int low0 = 0;// mTvChannelManager.getRfRilterRatingUHFLow0Margin();
		int low1 = 0;// mTvChannelManager.getRfRilterRatingUHFLow1Margin();
		String mValueStr = low0 + "     " + low1 + "       ";
		if (low0 == 0 || low1 == 0) {
			mValueStr += "NG";
			RFFilterCheck3 = false;
		} else {
			mValueStr += "OK";
			RFFilterCheck3 = true;
		}
		return mValueStr;
	}

	public String getUHFHigh() {
		// TODO Auto-generated method stub
		int high0 = 0;// mTvChannelManager.getRfRilterRatingUHFHigh0Margin();
		int high1 = 0;// mTvChannelManager.getRfRilterRatingUHFHigh1Margin();
		String mValueStr = high0 + "     " + high1 + "       ";
		if (high0 == 0 || high1 == 0) {
			mValueStr += "NG";
			RFFilterCheck4 = false;
		} else {
			mValueStr += "OK";
			RFFilterCheck4 = true;
		}
		return mValueStr;
	}

	public void startCheckRFFilter() {
		// TODO Auto-generated method stub
		// mTvChannelManager.runningTDA18273CheckRFFilterRobustness();
	}

	public String getRFFilterCheck() {
		// TODO Auto-generated method stub
		if (RFFilterCheck1 && RFFilterCheck2 && RFFilterCheck3
				&& RFFilterCheck4) {
			return "OK";
		}
		return "NG";
	}

	public boolean SupportAtvNonStarndardAdjust() {
		// TODO Auto-generated method stub
		return false;// mTvChannelManager.supportAtvNonStarndardAdjust();
	}

	public int GetAtvNonstdVif_Top() {
		// TODO Auto-generated method stub
		return 0;// mTvChannelManager.getAtvNonstdVif_Top();
	}

	public void SetAtvNonstdVif_Top(int value) {
		// TODO Auto-generated method stub
		// mTvChannelManager.setAtvNonstdVif_Top(value);
	}

	public void SetAtvNonstdVd_AFEC_D9bit0(int value) {
		// TODO Auto-generated method stub
		// mTvChannelManager.setAtvNonstdVd_AFEC_D9bit0(value);
	}

	public int GetAtvNonstdVd_AFEC_D9bit0() {
		// TODO Auto-generated method stub
		return 0;// mTvChannelManager.getAtvNonstdVd_AFEC_D9bit0();
	}

	public void SetAtvNonstdVd_AFEC_D8bit3210(int value) {
		// TODO Auto-generated method stub
		// mTvChannelManager.setAtvNonstdVd_AFEC_D8bit3210(value);
	}

	public int GetAtvNonstdVd_AFEC_D8bit3210() {
		// TODO Auto-generated method stub
		return 0;// mTvChannelManager.getAtvNonstdVd_AFEC_D8bit3210();
	}

	public void SetAtvNonstdVd_AFEC_D5bit2(int value) {
		// TODO Auto-generated method stub
		// mTvChannelManager.setAtvNonstdVd_AFEC_D5bit2(value);
	}

	public int GetAtvNonstdVd_AFEC_D5bit2() {
		// TODO Auto-generated method stub
		return 0;// mTvChannelManager.getAtvNonstdVd_AFEC_D5bit2();
	}

	public void SetAtvNonstdVd_AFEC_D4(int value) {
		// TODO Auto-generated method stub
		// mTvChannelManager.setAtvNonstdVd_AFEC_D4(value);
	}

	public int GetAtvNonstdVd_AFEC_D4() {
		// TODO Auto-generated method stub
		return 0;// mTvChannelManager.getAtvNonstdVd_AFEC_D4();
	}

	public void SetAtvNonstdVif_ChinaDescramblerbox(int value) {
		// TODO Auto-generated method stub
		// mTvChannelManager.setAtvNonstdVif_ChinaDescramblerbox(value);
	}

	public int GetAtvNonstdVif_ChinaDescramblerbox() {
		// TODO Auto-generated method stub
		return 0;// mTvChannelManager.getAtvNonstdVif_ChinaDescramblerbox();
	}

	public String getTunerName() {
		// TODO Auto-generated method stub
		// zcj 2018-10-30 return mTvMiscManager.getTunerName();
		return "null";
	}

	public void setTunerName(String selName) {
		// TODO Auto-generated method stub
		Log.v("tv", "mMiscManager.saveTunerName(selName) =" + selName);
		// zcj 2018-10-30 mTvMiscManager.setTunerName(selName);
	}

	public int GetAtvNonstdVd_Hidev() {
		// TODO Auto-generated method stub
		return 0;// mTvChannelManager.getAtvNonstdVd_Hidev();
	}

	public void SetAtvNonstdVd_Hidev(int value) {
		// TODO Auto-generated method stub
		// mTvChannelManager.setAtvNonstdVd_Hidev(value);

	}

	public int getAtvNonstdVif() {
		// TODO Auto-generated method stub
		int value = 0;// mTvFactoryManager.getVifAgcRef();
		return value;
	}

	public void setAtvNonstdVif(int value) {
		// TODO Auto-generated method stub
		// mTvChannelManager.SetAtvNonstdVif_ChinaDescramblerBoxDelay(value);

	}

	// mst6586 add
	public int getAtvNonstdVif_AgcRef() {
		// TODO Auto-generated method stub
		MtkTvFApiInputSourceTypes.StructVifParams struct = new MtkTvFApiInputSourceTypes.StructVifParams();
		mMtkTvFApiInputSource.getInputSourceIniVifParams(struct);

		return struct.vifAgcRef;
	}

	public void setAtvNonstdVif_AgcRef(int value) {
		// TODO Auto-generated method stub
		// mTvFactoryManager.setVifAgcRef((short) value);
		mMtkTvFApiInputSource.setInputSourceIniAgcRef(value);

	}
/*
	public int getAtvNonstdVif_CrKp() {
		// TODO Auto-generated method stub
		MtkTvFApiInputSourceTypes.StructVifParams struct = new MtkTvFApiInputSourceTypes.StructVifParams();
		mMtkTvFApiInputSource.getInputSourceIniVifParams(struct);

		return struct.vifCrKp;
	}
*/
	public MtkTvFApiInputSourceTypes.StructVifParams getVifParams() {
		// TODO Auto-generated method stub
		MtkTvFApiInputSourceTypes.StructVifParams struct = new MtkTvFApiInputSourceTypes.StructVifParams();
		mMtkTvFApiInputSource.getInputSourceIniVifParams(struct);

		return struct;
	}
/*
	public void setAtvNonstdVif_CrKp(int value) {
		// TODO Auto-generated method stub
		// mTvFactoryManager.setVifCrKp((short) value);
		mMtkTvFApiInputSource.setInputSourceIniCrKp(value);
	}
*/
/*
	public int getAtvNonstdVif_CrKi() {
		// TODO Auto-generated method stub
		// zcj 2018-10-30 int value =mTvFactoryManager.getVifCrKi();
		MtkTvFApiInputSourceTypes.StructVifParams struct = new MtkTvFApiInputSourceTypes.StructVifParams();
		mMtkTvFApiInputSource.getInputSourceIniVifParams(struct);

		return struct.vifCrKi;
	}

	public void setAtvNonstdVif_CrKi(int value) {
		// TODO Auto-generated method stub
		// mTvFactoryManager.setVifCrKi((short) value);
		mMtkTvFApiInputSource.setInputSourceIniCrKi(value);
	}
*/
	public int getAtvNonstdVif_AsiaSignalOption() {
		// TODO Auto-generated method stub
		// zcj 2018-10-30 int value =mTvFactoryManager.getVifAsiaSignalOption()
		// ? 1 : 0;
		MtkTvFApiInputSourceTypes.StructVifParams struct = new MtkTvFApiInputSourceTypes.StructVifParams();
		mMtkTvFApiInputSource.getInputSourceIniVifParams(struct);

		return struct.vifAsiaOption ? 1 : 0;
	}

	public void setAtvNonstdVif_AsiaSignalOption(int value) {
		// TODO Auto-generated method stub
		// mTvFactoryManager.setVifAsiaSignalOption((value!=0));
		mMtkTvFApiInputSource.setInputSourceIniAsiaSignalOption(value != 0);
	}

	public int getAtvNonstdVif_ClampGainOvNegative() {
		// TODO Auto-generated method stub
		// zcj 2018-10-30 int value
		// =mTvFactoryManager.getVifClampGainOvNegative();
		MtkTvFApiInputSourceTypes.StructVifParams struct = new MtkTvFApiInputSourceTypes.StructVifParams();
		mMtkTvFApiInputSource.getInputSourceIniVifParams(struct);

		return struct.vifClampGainOvNegative;
	}

	public void setAtvNonstdVif_ClampGainOvNegative(int value) {
		// TODO Auto-generated method stub
		// mTvFactoryManager.setVifClampGainOvNegative(value);
		mMtkTvFApiInputSource.setInputSourceIniClampgainGainOvNegative(value);
	}

	public int getAtvNonstdVif_ChinaDescramblerBoxDelay() {
		// TODO Auto-generated method stub
		int value = 0;
		value = Integer
				.parseInt(mMtkTvFApiInputSource
						.getInputSourceIniParameter(
								MtkTvFApiInputSourceIniManager.MTKTV_FAPI_INI_TYPE_INPUTSOURCE_ENUM.E_MTK_FAPI_INI_TYPE_VIF_SETTING,
								MtkTvFApiInputSourceIniManager.MTKTV_FAPI_KEY_TYPE_INPUTSOURCE_ENUM.E_MTK_FAPI_KEY_TYPE_VIF_CHINA_DESCRAMBLER_BOX_DELAY));

		return value;
	}

	public void setAtvNonstdVif_ChinaDescramblerBoxDelay(int value) {
		// TODO Auto-generated method stub
		// mTvFactoryManager.setChinaDescramblerBoxDelay(value);
		// mTvChannelManager.selectProgram(mTvChannelManager.getCurrentChannelNumber(),
		// zcj 2018-10-30 TvChannelManager.SERVICE_TYPE_ATV);
		mMtkTvFApiInputSource.setInputSourceIniChinaDescramblerBoxDelay(value);

	}

	public int getAtvNonstdVif_CrThreshold() {
		// TODO Auto-generated method stub
		MtkTvFApiInputSourceTypes.StructVifParams struct = new MtkTvFApiInputSourceTypes.StructVifParams();
		mMtkTvFApiInputSource.getInputSourceIniVifParams(struct);

		return (int) struct.vifCrThreshold;
	}

	public void setAtvNonstdVif_CrThreshold(int value) {
		// TODO Auto-generated method stub
		// mTvFactoryManager.setVifCrThreshold(value);
		mMtkTvFApiInputSource.setInputSourceIniCrThreshold(value);
	}

	public int getAtvNonstdVif_DelayReduce() {
		// TODO Auto-generated method stub
		return 0;
	}

	public void setAtvNonstdVif_DelayReduce(int value) {
		// TODO Auto-generated method stub
		// zcj 2018-10-30 mTvFactoryManager.setDelayReduce((short)value);
		// mMtkTvFApiInputSource.setInputSourceIniParameter(MtkTvFApiInputSourceIniManager.MTKTV_FAPI_INI_TYPE_INPUTSOURCE_ENUM.E_MTK_FAPI_INI_TYPE_VIF_SETTING,
		// key, data);

	}

	public int getAtvNonstdVif_VifVersion() {
		// TODO Auto-generated method stub
		// zcj 2018-10-30 int value =mTvFactoryManager.getVifVersion();
		int value = 0;
		String tmpString = mMtkTvFApiInputSource
				.getInputSourceIniParameter(
						MtkTvFApiInputSourceIniManager.MTKTV_FAPI_INI_TYPE_INPUTSOURCE_ENUM.E_MTK_FAPI_INI_TYPE_VIF_SETTING,
						MtkTvFApiInputSourceIniManager.MTKTV_FAPI_KEY_TYPE_INPUTSOURCE_ENUM.E_MTK_FAPI_KEY_TYPE_VIF_VERSION);
		if (TextUtils.isEmpty(tmpString))
			value = Integer.parseInt(tmpString);
		return value;
	}

	public void setAtvNonstdVif_VifVersion(int value) {
		// TODO Auto-generated method stub
		// zcj 2018-10-30 mTvFactoryManager.setVifVersion((short)value);
		mMtkTvFApiInputSource
				.setInputSourceIniParameter(
						MtkTvFApiInputSourceIniManager.MTKTV_FAPI_INI_TYPE_INPUTSOURCE_ENUM.E_MTK_FAPI_INI_TYPE_VIF_SETTING,
						MtkTvFApiInputSourceIniManager.MTKTV_FAPI_KEY_TYPE_INPUTSOURCE_ENUM.E_MTK_FAPI_KEY_TYPE_VIF_VERSION,
						value + "");
	}

	public int getAtvNonstdVD_AefcD4() {
		// TODO Auto-generated method stub
		int value = mMtkTvFApiInputSource
				.getFactoryVdPara(MtkTvFApiInputSourceTypes.EnumTunerAtvVdType.E_MI_TUNER_VD_FACTORY_DEBUGGROUP1);
		return value;
	}

	public void setAtvNonstdVD_AefcD4(int value) {
		// TODO Auto-generated method stub
		// mTvFactoryManager.setAefcD4((short)value);
		mMtkTvFApiInputSource
				.setFactoryVdPara(
						MtkTvFApiInputSourceTypes.EnumTunerAtvVdType.E_MI_TUNER_VD_FACTORY_DEBUGGROUP1,
						value);
	}

	public int getAtvNonstdVD_AefcD5Bit2() {
		// TODO Auto-generated method stub
		int value = mMtkTvFApiInputSource
				.getFactoryVdPara(MtkTvFApiInputSourceTypes.EnumTunerAtvVdType.E_MI_TUNER_VD_FACTORY_HSYNCPLLSPEEDDPLMAX);
		return value;
	}

	public void setAtvNonstdVD_AefcD5Bit2(int value) {
		// TODO Auto-generated method stub
		// mTvFactoryManager.setAefcD5Bit2((short)(value<<2));
		mMtkTvFApiInputSource
				.setFactoryVdPara(
						MtkTvFApiInputSourceTypes.EnumTunerAtvVdType.E_MI_TUNER_VD_FACTORY_HSYNCPLLSPEEDDPLMAX,
						value);

	}

	public int getAtvNonstdVD_AefcD8Bit3210() {
		// TODO Auto-generated method stub
		int value = mMtkTvFApiInputSource
				.getFactoryVdPara(MtkTvFApiInputSourceTypes.EnumTunerAtvVdType.E_MI_TUNER_VD_FACTORY_DEBUGGROUP2);
		return value;
	}

	public void setAtvNonstdVD_AefcD8Bit3210(int value) {
		// TODO Auto-generated method stub
		// mTvFactoryManager.setAefcD8Bit3210((short)value);
		mMtkTvFApiInputSource
				.setFactoryVdPara(
						MtkTvFApiInputSourceTypes.EnumTunerAtvVdType.E_MI_TUNER_VD_FACTORY_DEBUGGROUP2,
						value);
	}

	public int getAtvNonstdVD_AefcD9Bit0() {
		// TODO Auto-generated method stub
		int value = mMtkTvFApiInputSource
				.getFactoryVdPara(MtkTvFApiInputSourceTypes.EnumTunerAtvVdType.E_MI_TUNER_VD_FACTORY_RFLOWHSYNCPATCH);
		return value;
	}

	public void setAtvNonstdVD_AefcD9Bit0(int value) {
		// TODO Auto-generated method stub
		// mTvFactoryManager.setAefcD9Bit0((short)value);
		mMtkTvFApiInputSource
				.setFactoryVdPara(
						MtkTvFApiInputSourceTypes.EnumTunerAtvVdType.E_MI_TUNER_VD_FACTORY_RFLOWHSYNCPATCH,
						value);
	}

	public int getAtvNonstdVD_AefcD7HighBound() {
		// TODO Auto-generated method stub
		int value = mMtkTvFApiInputSource
				.getFactoryVdPara(MtkTvFApiInputSourceTypes.EnumTunerAtvVdType.E_MI_TUNER_VD_FACTORY_COLORKILLHIGHBOUND);
		return value;
	}

	public void setAtvNonstdVD_AefcD7HighBound(int value) {
		// TODO Auto-generated method stub
		// mTvFactoryManager.setAefcD7HighBound((short)value);
		mMtkTvFApiInputSource
				.setFactoryVdPara(
						MtkTvFApiInputSourceTypes.EnumTunerAtvVdType.E_MI_TUNER_VD_FACTORY_COLORKILLHIGHBOUND,
						value);
	}

	public int getAtvNonstdVD_AefcD7LowBound() {
		// TODO Auto-generated method stub
		int value = mMtkTvFApiInputSource
				.getFactoryVdPara(MtkTvFApiInputSourceTypes.EnumTunerAtvVdType.E_MI_TUNER_VD_FACTORY_COLORKILLLOWBOUND);
		return value;
	}

	public void setAtvNonstdVD_AefcD7LowBound(int value) {
		// TODO Auto-generated method stub
		// mTvFactoryManager.setAefcD7LowBound((short)value);
		mMtkTvFApiInputSource
				.setFactoryVdPara(
						MtkTvFApiInputSourceTypes.EnumTunerAtvVdType.E_MI_TUNER_VD_FACTORY_COLORKILLLOWBOUND,
						value);
	}

	public int getAtvNonstdVD_AefcA0() {
		// TODO Auto-generated method stub
		int value = mMtkTvFApiInputSource
				.getFactoryVdPara(MtkTvFApiInputSourceTypes.EnumTunerAtvVdType.E_MI_TUNER_VD_FACTORY_HSYNCPLLSPEEDDPLK1);
		return value;
	}

	public void setAtvNonstdVD_AefcA0(int value) {
		// TODO Auto-generated method stub
		// mTvFactoryManager.setAefcA0((short)value);
		mMtkTvFApiInputSource
				.setFactoryVdPara(
						MtkTvFApiInputSourceTypes.EnumTunerAtvVdType.E_MI_TUNER_VD_FACTORY_HSYNCPLLSPEEDDPLK1,
						value);
	}

	public int getAtvNonstdVD_AefcA1() {
		// TODO Auto-generated method stub
		int value = mMtkTvFApiInputSource
				.getFactoryVdPara(MtkTvFApiInputSourceTypes.EnumTunerAtvVdType.E_MI_TUNER_VD_FACTORY_HSYNCPLLSPEEDDPLK2);

		return value;
	}

	public void setAtvNonstdVD_AefcA1(int value) {
		// TODO Auto-generated method stub
		// mTvFactoryManager.setAefcA1((short)value);
		mMtkTvFApiInputSource
				.setFactoryVdPara(
						MtkTvFApiInputSourceTypes.EnumTunerAtvVdType.E_MI_TUNER_VD_FACTORY_HSYNCPLLSPEEDDPLK2,
						value);
	}

	public int getAtvNonstdVD_Aefc66Bit76() {
		// TODO Auto-generated method stub
		int value = mMtkTvFApiInputSource
				.getFactoryVdPara(MtkTvFApiInputSourceTypes.EnumTunerAtvVdType.E_MI_TUNER_VD_FACTORY_FIXHVSLICELEVEL);
		return value;
	}

	public void setAtvNonstdVD_Aefc66Bit76(int value) {
		// TODO Auto-generated method stub
		// mTvFactoryManager.setAefc66Bit76((short)(value<<6));
		mMtkTvFApiInputSource
				.setFactoryVdPara(
						MtkTvFApiInputSourceTypes.EnumTunerAtvVdType.E_MI_TUNER_VD_FACTORY_FIXHVSLICELEVEL,
						value);
	}

	public int getAtvNonstdVD_Aefc6EBit7654() {
		// TODO Auto-generated method stub
		int value = mMtkTvFApiInputSource
				.getFactoryVdPara(MtkTvFApiInputSourceTypes.EnumTunerAtvVdType.E_MI_TUNER_VD_FACTORY_VSLICELEVEL);

		return value;
	}

	public void setAtvNonstdVD_Aefc6EBit7654(int value) {
		// TODO Auto-generated method stub
		// mTvFactoryManager.setAefc6EBit7654((short)(value<<4));
		mMtkTvFApiInputSource
				.setFactoryVdPara(
						MtkTvFApiInputSourceTypes.EnumTunerAtvVdType.E_MI_TUNER_VD_FACTORY_VSLICELEVEL,
						value);
	}


	public int dumpChannelList(int value) {
		return mMtkTvConfig.dumpChannelList(value);
	}

	public int loadChannelList(int value) {
		return mMtkTvConfig.loadChannelList(value);
	}
	public int selectfirstChannel() {
		int channelId=0;
		int curtCh=0;
		int svlId=mMtkTvConfig.getConfigValue(MtkTvConfigType.CFG_BS_SVL_ID);
		List<MtkTvChannelInfoBase> list =mtkTvChannelList.getChannelListByFilter(svlId, 
				MtkTvChCommonBase.SB_VNET_ACTIVE|MtkTvChCommonBase.SB_VNET_FAKE, curtCh, 10000, 10000);
		for(MtkTvChannelInfoBase channel :list){
			if(channel!=null){
				channelId =channel.getChannelId();
				break;
			}
		}
		return mtkTvBroadcast.channelSelect(channelId, false);
		
	}
	public int dumpFactoryChannelListByPath(int value,String path) {
		return mMtkTvConfig.dumpChannelListByPath(value, path);
	}
	public int loadFactoryChannelListByPath(int value,String path) {
		return mMtkTvConfig.loadChannelListByPath(value, path);
	}


    public void setRecordAll(int isRecordAll) {
		if (isRecordAll == 1) {
			mTvRecord.setRecordAll(true);
		} else {
			mTvRecord.setRecordAll(false);
		}
    }

	public int getRecordAll() {
		int mRecordindex=0;
		return mRecordindex = mTvRecord.getRecordAll() ? 1 : 0;
	}
}
